/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package BugTracking;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Date;

/**
 *
 * @author MPanuera
 */
public class Exceptions {
    String file="";
    /**
    *
    * Nos permite manejar las excepciones, guardandolas en el archivo error.log
    */
    public Exceptions(){
        file="error.log";
    }
    /**
     *
     * @param error
     * error a guardar en el log
     */
    public void write(String error){
        FileWriter fWriter = null;
        BufferedWriter bWriter = null;
        try {
            fWriter = new FileWriter(file,true);
            bWriter = new BufferedWriter(fWriter);
            Date dateNow = new Date();
            //System.out.println("Ahora es: " + fechaAhora);
            fWriter.write(dateNow + "\t" + error+"\n");
            fWriter.close();
        }
        catch (IOException ex) {
            ex.getMessage();
            System.out.println("Error al escribir error");
        }
    }
}